package com.team2.insulatingtools.modular.tools.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.team2.insulatingtools.modular.tools.dto.ToolKeeperLogDto;
import com.team2.insulatingtools.modular.tools.dto.ToolMsgDto;
import com.team2.insulatingtools.modular.tools.dto.QuotaDetailDto;
import com.team2.insulatingtools.modular.tools.dto.ToolsDto;
import com.team2.insulatingtools.modular.tools.entity.ToolDetail;
import com.team2.insulatingtools.modular.tools.entity.Tools;
import com.team2.insulatingtools.modular.tools.pojo.response.ToolReminderResponse;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

import java.util.List;

import javax.validation.constraints.Past;

/**
 * 绝缘工具  Mapper 接口
 *
 * @author team2
 * @date 2023/04/03 09:48
 */
public interface ToolsMapper extends BaseMapper<Tools> {
    /**
     * 查询限额
     *
     * @author team2
     * @date 2023/04/03 09:48
     */
    ToolsDto selectAllByCount(Integer qid, String name);

    /**
     * 查询是否在限额单中
     *
     * @author team2
     * @date 2023/04/03 09:48
     */
    ToolsDto selectExists(Integer qid, String name);

    /**
     * 查询添加的工具是否是表中第一个
     *
     * @author team2
     * @date 2023/04/03 09:48
     */
    ToolsDto selectIfNew(Integer qid, String name);


    /**
     * 查询添加的工具是否是表中第一个
     *
     * @author team2
     * @date 2023/04/03 09:48
     */
    ToolsDto selectDelete(Integer id);

    List<ToolMsgDto> selByWorkshop(String workshopId);

    List<ToolMsgDto> selByGroup(String groupId);

    List<ToolMsgDto> selByWorkshopAndTools(String workshopId, int cid);

    List<ToolMsgDto> selByGroupAndTools(String groupId, int cid);

    int changeKeeperBatch(int id, String keeper);

    int insertKeeperLog(ToolKeeperLogDto toolKeeperLogDto);

    List<ToolKeeperLogDto> selKeeperLog(int tid);

    List<ToolReminderResponse> getToolExpire(@Param("date") LocalDate date, @Param("teamIdList") List<Long> teamIdList);

    QuotaDetailDto selectCurrentCountByOrgQuota(@Param("quotaId") Integer quotaId
            , @Param("categoryName") String categoryName);

    void updateBatchByExpireDate(String expireDate);
}
